package com.ourway.dtos;

import com.ourway.entity.FeiShuUser;
import com.ourway.entity.FeiShuUserSync;
import lombok.Builder;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * 用户检查视图
 *
 * @author liuweiheng
 * @since 2021/12/12
 */
@Data
@Accessors(chain = true)
@Builder
public class CheckUserResultDTO implements Serializable {

    private Boolean success;

    private String message;

    private UserDTO old;

    private FeiShuUserSync feiShuUserSync;

    private FeiShuUser feiShuUser;

    public final Boolean hasError = Boolean.TRUE.equals(success);

    public static CheckUserResultDTO error(String message) {
        return CheckUserResultDTO.builder().success(Boolean.FALSE).message(message).build();
    }

    public static CheckUserResultDTO success(String message, UserDTO old, FeiShuUserSync feiShuUserSync, FeiShuUser feiShuUser) {
        return CheckUserResultDTO.builder().success(Boolean.TRUE).message(message).old(old).feiShuUserSync(feiShuUserSync).feiShuUser(feiShuUser).build();
    }

}
